<?php require VIEW_PATH."/header.php";?>
<body>
    <link rel="stylesheet" type="text/css" href="Public/org/bootstrap/css/bootstrap.css">
    <div class="hd-menu-list">
        <ul>
            <li class="active"><a href="#">商品管理</a></li>
            <li><a href="{{U('add')}}">添加商品</a></li>
        </ul>
    </div>

    <table class="hd-table hd-table-list">
        <thead>
            <tr>
                <td class="hd-w50">编号</td>
                <td>商品名称</td>
                <td>上架时间</td>
                <td>栏目</td>
                <td>商品类型</td>
                <td class="hd-w200">操作</td>
            </tr>
        </thead>
        <tbody>
            {{foreach from="$data['data']" value="$v"}}
            <tr>
                <td>{{$v['goods_id']}}</td>
                <td>
                    {{if value="$v['thumb_pic']"}}
                    <img src="{{$v['thumb_pic']}}" style="width:50px">
                    {{endif}}
                    {{$v['goods_name']}}
                </td>
                <td>{{date('Y/m/d',$v['create_at'])}}</td>
                <td>
                    <a href="{{U('Admin/Goods/index',array('cat_id'=>$v['cat_id']))}}">
                        {{$v['cat_name']}}
                    </a>
                </td>
                <td>
                     {{$v['type_name']}}
                </td>
                <td class="hd-w200">
                    <a href="{{U('edit',array('goods_id'=>$v['goods_id']))}}">修改</a> |
                    <a href="{{U('goodstore',array('goods_id'=>$v['goods_id']))}}">库存</a> |
                    <a href="javascript:is_delete({{$v['goods_id']}})">放入回收站</a>
                </td>
            </tr>
            {{endforeach}}
        </tbody>
    </table>
    <div class="pagination">
        {{$data['page']}}
    </div>
    <script type="text/javascript">
    function is_delete (goods_id) {
        if (confirm('确定移入回收站吗?')) {
            $.get('index.php?m=Admin&c=goods&a=is_delete',{goods_id,goods_id},function(data){
                if (data==0) {
                    alert('已放入回收站')
                    location.href=location.href;
                }
                else
                {
                    alert('放入回收站失败')
                }
            })
        };
    }
    </script>
</body>
</html>